<template>
  <div class="tab">
    <!-- <router-view></router-view> -->
    <router-view></router-view>
    <!-- 设置默认路由，为每次路由导航（跳转）的路由。 -->

    <van-tabbar v-model="active" route>
      <van-tabbar-item
        :name="v.name"
        icon="v.icon"
        v-for="v in tabarr"
        :key="v.path"
        :to="'/tab/' + v.path"
        >{{ v.name }}</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>

<script>
export default {
  data() {
    return {
      active: "首页",
      // path: "home",
      tabarr: [
        { name: "首页", path: "home", icon: "home-o" },
        { name: "案例", path: "case", icon: "apps-o" },
        { name: "预约", path: "sub", icon: "under-o" },
        { name: "我的", path: "my", icon: "manager-o" },
      ],
    };
  },
  methods: {
    tab(v) {
      console.log(v);
      this.$router.push(v.path);
    },
  },
};
</script>

<style>
</style>